Libname sortie 'U:\Recherche\Econometrics_paper\Data\';

data Temp1;
set sortie.Countries_clean;

Rzero=0.04; /* Annual riskless rate */

if country ^='UK' then delete; /* Selects country to be studied */
deltaNO=dif(NO);
if year<1940 then delete; /* selects estimation interval */
 /*if year>1985 then delete;*/
run;



proc standard data=Temp1 mean=0 out=Temp2;

/* de-means the variables listed after the var statement -and these variables only */

var CA1 deltaNO;

run;

data Temp3;

set Temp2;

CA1_1=lag(CA1);
CA1_2=lag2(CA1);
CA1_3=lag3(CA1);
CA1_4=lag4(CA1);
CA1_5=lag5(CA1);
CA1_6=lag6(CA1);
CA1_7=lag7(CA1);
CA1_8=lag8(CA1);
CA1_9=lag9(CA1);
CA1_10=lag10(CA1);

deltaNO_1=lag(deltaNO);
deltaNO_2=lag2(deltaNO);
deltaNO_3=lag3(deltaNO);
deltaNO_4=lag4(deltaNO);
deltaNO_5=lag5(deltaNO);
deltaNO_6=lag6(deltaNO);
deltaNO_7=lag7(deltaNO);
deltaNO_8=lag8(deltaNO);
deltaNO_9=lag9(deltaNO);
deltaNO_10=lag10(deltaNO);

R1=CA1-deltaNO-(1+Rzero)*CA1_1; /* to do the "R" test */

run; 




/* 1 lag */

proc reg data=Temp3;  
 model r1=CA1coint_1 deltaNO_1 /noint noprint;
 test CA1coint_1= deltaNO_1=0;
run;
/* 2 lags */

proc reg data=Temp3; /* tests ac It-1 */
 model r1=CA1_1 CA1_2 deltaNO_1 deltaNO_2 /noint noprint;
 test CA1_1= CA1_2= deltaNO_1= deltaNO_2=0;
run;

/* 3 lags */

proc reg data=Temp3; /* tests ac It-1 */
 model r1=CA1_1 CA1_2 CA1_3 deltaNO_1 deltaNO_2 deltaNO_3 /noint noprint;
 test CA1_1=CA1_2=CA1_3=deltaNO_1=deltaNO_2=deltaNO_3=0;
run;

/* 4 lags */

proc reg data=Temp3;
 model r1=CA1coint_1 CA1coint_2 CA1coint_3 CA1coint_4 deltaNO_1 deltaNO_2 deltaNO_3 deltaNO_4  / noint noprint;
 test CA1coint_1= CA1coint_2= CA1coint_3= CA1coint_4= deltaNO_1= deltaNO_2= deltaNO_3= deltaNO_4= 0;
run;

/* 8 lags */

proc reg data=Temp3;
 model r1=CA1coint_1 CA1coint_2 CA1coint_3 CA1coint_4 CA1coint_5 CA1coint_6 CA1coint_7 CA1coint_8 deltaNO_1 deltaNO_2 deltaNO_3 deltaNO_4 deltaNO_5 deltaNO_6 deltaNO_7 deltaNO_8 / noint noprint;
 test CA1coint_1= CA1coint_2= CA1coint_3= CA1coint_4= CA1coint_5= CA1coint_6= CA1coint_7= CA1coint_8= deltaNO_1= deltaNO_2= deltaNO_3= deltaNO_4= deltaNO_5= deltaNO_6= deltaNO_7= deltaNO_8;
run;
